/**
 * Created by zheng on 2018/1/30.
 */

let button = require('../../buttom/index.vue');

export default {
  name: 'ZgTableHeader',
  component: {
    button
  },
  props: {
    store: {
      type: Object
    }
  },
  computed: {
    data() {
      return this.store.state.data;
    },
  },
  methods: {
    getStore(){
      return this.store.state.data;
    }
  },
  render: function render(h) {
    return (
      <table
        class="zh-table-body "
        cellspacing="0"
        cellpadding="0"
        border="0">
        <tbody>
        {
          this._l(this.data, item=>
            <tr>
              {
                this._l(this.store.state.columns, column=>
                    <td class="zh-table-cell"
                        style={{
                          display: (column.prop=='hidden'?'none':''),
                        }}>
                      {
                        function () {
                          let k = column.renderCell(h, item)
                          k.item = item;
                          if (k.children[0])
                            k.children[0].parent = k;
                          return k;
                        }()
                      }</td>
                )
              }
            </tr>
          )
        }
        </tbody>
      </table>
    )
  }
}
